package com.disney.dolcn.invitemail.application;

import javax.servlet.ServletException;
 
import com.go.teaservlet.Application;
import com.go.teaservlet.ApplicationConfig;
import com.go.teaservlet.ApplicationRequest;
import com.go.teaservlet.ApplicationResponse;
/**
 * 
 * @author hawang
 *
 */
public final class InviteApplication implements Application {
	
	private static final String MAILTEMPLATE="mail_template";
	
	private String mailTemplateFile = "";

	/**
	 * 创建tea context object.
	 * 
	 * @param req
	 *            request
	 * @param resp
	 *            response
	 * 
	 * @return 创建的context对象
	 */
	public Object createContext(ApplicationRequest req, ApplicationResponse resp ) {
		return new InviteContext(req, resp,mailTemplateFile);
	}

	/**
	 * 销毁自定义tea application.
	 */
	public void destroy() {
		// TODO Auto-generated method stub
	}

	/**
	 * 获取context的类型.
	 * 
	 * @return context的类型
	 */
	public Class<InviteContext> getContextType() {
		return InviteContext.class;
	}

	/**
	 * 初始化tea application.
	 * 
	 * @param config
	 *            application的配置
	 * 
	 * @throws ServletException
	 *             servlet异常
	 */
	public void init(ApplicationConfig config) throws ServletException {
		// TODO Auto-generated method stub
		mailTemplateFile = config.getInitParameter(MAILTEMPLATE);

	}

}
